<?php
/**
 * The template for displaying Search Results pages.
 *
 * @package WordPress
 * @subpackage pet-wares
 * @since  1.0
 */

get_header(); ?>
<?php 
$the_query = new WP_Query( $query_string );
?>
<div id='content' class="grid_9">                     


<?php if ( have_posts() ): ?>
	<div class='gray-box'>
    	<div class='gray-box-bg category-name-bg'>
			<h2><?php printf( __( 'Search Results for: %s', 'pet-wares' ), '<span>' . get_search_query() . '</span>' ); ?></h2>
		</div>
    </div>
<?php while ( $the_query->have_posts() ) : $the_query->the_post();?>
<div class='member'>
<?php
            	$url = get_post_meta($post->ID, 'kda_memeber-site-url', true);       	
            ?>
	<div class="logo grid_3 alpha">
				<?php 
				if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
				?>
					<a href="<?php echo $url ?>" target="_blank"><?php the_post_thumbnail(); ?></a>
				<?php
				}
				?>
	</div>
	<div class="member-content grid_6 omega">
           
            	<a class="catLink" href="<?php echo $url; ?>" target="_blank"><?php the_title(); ?></a>
            	<?php the_content(); ?>
			</div>  
		</div>
		<div class='member-bg'>
		</div>
<?php endwhile; ?>
				<?php
					wp_reset_postdata();
				  $search = new WP_Query($search_query);	  
				  echo get_template_part( 'loop', 'search' );
				?>
<?php else : ?>
<div class="gray-box grid_9">
	<div class='gray-box-bg'>
		<h2 class="page-title"><?php printf( __( 'Search Results for: %s', 'pet-wares' ), '<span>' . get_search_query() . '</span>' ); ?></h2>
	</div>
</div>
				<div class='member grid_9'>
					<div class="entry-content">
						<p><?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'pet-wares' ); ?></p>
						<?php get_search_form(); ?>
					</div><!-- .entry-content -->
					</div>
					<div class='grid_9 member-bg'></div>
<?php endif; ?>
</div><!-- #container -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>
